<?php 
$connection_crimecar = mysql_connect("1.234.20.151", "cam", "5678") ;
//$connection_crimecar = mysql_connect("localhost", "long", "") ;
mysql_select_db("elicam", $connection_crimecar);
mysql_query("set names 'utf8'",$connection_crimecar);
$q="select a.idx,a.carnumber,a.camera_id,co.id,co.name,co.host,co.go_mode,a.filename,d.cartype,d.code1,co.pos_x,co.pos_y 
			from alarm_display a,favourite f,configcamera co,alarm_dat d 
			where a.carnumber=d.carnumber and co.id=f.camera_ID and co.id=a.camera_id GROUP BY a.carnumber";
$kq = mysql_query($q,$connection_crimecar);
$rs="";
if(mysql_num_rows($kq)>0){
	while($row=mysql_fetch_array($kq)){
			if($rs==""){
				$rs= chop($row[cartype]);
			}else{
				$rs .=",".chop($row[cartype]);
			}
	}
}
echo $rs;
mysql_close($connection_crimecar);
?>